<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<h1>表单</h1>
		
	</body>
	<script type="text/javascript">
		function getValue(){
			let oUsername =document.getElementById('username')
		    console.dir(oUsername.value)
		    let oPassword =document.getElementById('password')
		    console.dir(oPassword.value)
		    let oPasswordAgain =document.getElementById('passwordAgain')
		    console.dir(oPasswordAgain.value)
		    if(usernameStr.length==0){
		    	alert('请输入用户名')
		    	return
		    }
//		    let oSexMale =document.getElementById('sexMale')	    
//		    let oSexFemale =document.getElementById('sexFemale')
//		    if(oSexMale.checked){
//		    	console.log('性别：男')
//		    }
//		    if(oSexFemale.checked){
//		    	console.log('性别：女')
//		    }
            Map map =new Map();
            map.set("1",'男')
            map.set("2",'女')
            let oSex =document.getElementsByName('sex') 
            let sexValue=''
            for (var i=0;i<oSex.length;i++){
            	if(oSex[i].checked){
            		sexValue=oSex[i].value)
            	}
            }
		    if(sexValue.length==0){
		    	console.log('未选中性别')
		    }else{
		    	console.log(map.get(sexValue))
		    }
		    
		    let hobbyValueList=[]
		    let oHobby=document.getElementsByName('hobby')
		    for(var i=0;i<oHobby.length;i++){
		    	if(oHobby[i].checked){
		    		hobbyValueList.push(oHobby[i].value)
		    	}
		    }
		    console.dir(hobbyValueList.join(','))
		    let oSelect =document.getElementById('select')
		    let oOptions=oSelect.options
		    let selestedIndex=oSelect.selectedIndex
		    console.dir(oOptions[selectedIndex].value)
		    
		    let oMyInfo=document.getElementById('myInfo')
		    console.dir(oMyInfo.value)
		    
		    
		}
	</script>
</html>
